/*function callback(serverData, serverStatus, id) {
	if (serverStatus == 200) {
		document.getElementById(id).innerHTML = serverData;
		alert(serverData);
	} else {
		document.getElementById(id).innerHTML = 'Loading...';
	}
}*/

function ajaxRequest(openThis, callback) {
	var AJAX = null;

	if (window.XMLHttpRequest) {
		AJAX = new XMLHttpRequest();
	} else {
		AJAX = new ActiveXObject("Microsoft.XMLHTTP");
	}

	if (AJAX == null) {
		alert("no AJAX support!");
		return false;
	}

	AJAX.onreadystatechange = function() {
//		alert(AJAX.readyState +" "+ AJAX.status);

//		if (AJAX.readyState == 4 || AJAX.readyState == "complete") {
		if (AJAX.readyState != 4) return;

		var json;
		if (AJAX.status == 200) { // OK
			json = JSON.parse(AJAX.responseText);
		}
		callback(json, AJAX.status, AJAX.responseText);
	}

	var url = openThis;
	if (url.indexOf("?") < 0) {
		url += "?ts=" + new Date().getTime();
	} else {
		url += "&ts=" + new Date().getTime();
	}
	AJAX.open("GET", url, true);
	AJAX.send(null);
}
